package main

import (
	"fmt"
	"go-amis-admin/admin"
	"go-amis-admin/example"
	"os"

	"gopkg.in/yaml.v3"
)

func main() {
	data, err := os.ReadFile("config.yml")
	if err != nil {
		panic(fmt.Sprintf("读取配置文件错误:%+v", err))
	}
	var config admin.Config
	if err := yaml.Unmarshal(data, &config); err != nil {
		panic(fmt.Sprintf("配置文件格式错误:%+v", err))
	}
	app := admin.NewApp(&config)
	site := app.DefaultSite()
	example.Setup(site)
	app.Run()
}
